define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'crm/business.index/index',
        add_url: 'crm/business.index/add',
        edit_url: 'crm/business.index/edit',
        delete_url: 'crm/business.index/delete',
        modify_url: 'crm/business.index/modify',
        recycle_url: 'crm/business.index/recycle',
        record_url: 'crm/business.index/record'
    };

    var Controller = {

        index: function () {

            ea.table.render({
                init: init,
                cols: [[
                    { type: "checkbox", width: 50 },
                    { field: 'id', width: 60, title: 'ID', sort: true, search:false},
					{ field: 'name', title: '商机名称' ,width: 100},   
                    { field: 'customer.name', title: '客户名称' ,width: 100},   
                    { field: 'total_price', title: '产品金额' ,width: 100},   
                    { field: 'remark', width: 250,title: '备注',search:false },     
					{ field: 'deal_time', title: '预计成交' ,width: 100},   
					{ field: 'mobile', title: '手机' ,width: 120}, 
                    { field: 'next_time',  title: '创建时间',width: 160,search:false},
					{ field: 'create_user.username', title: '创建人' ,width: 100}, 
					{ field: 'owner_user.username', title: '负责人' ,width: 100}, 
					{ field: 'next_time', title: '下次跟进' ,width: 100},
                    { field: 'update_time',  title: '创建时间',width: 160,search:false},
					{ field: 'is_end',  title: '状态',width: 160,search:false},
                    { 
						title: '操作', 
						minWidth: 80, 
						width: 160, 
						templet: ea.table.tool, 
						align: "center", 
						fixed: 'right',
						operat: [
							'record',
							'edit'
						]
					}
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        record: function () {
            ea.listen();
        }
    };
    return Controller;
});